from game.gui.label import MultiLabel
# To change this template, choose Tools | Templates
# and open the template in the editor.


class InventoryManager:
    def __init__(self, rect):
        self.sep = "<br>"
        self.widget = MultiLabel(rect=rect, padding=(0,0,0,20))

    def set(self, inv):
        self.inventory = inv

    def rebuild(self):

        data = []
        for k,v in self.inventory.items():
            data.append("  -= {0} =-".format(k))
            for i in v:
                data.append("<empty>" if i is None else i.name)

        out = self.sep.join(data)

        self.widget.set_text(out)


